package com.itheima.springbootmybatis.service.impl;

import com.itheima.springbootmybatis.mapper.UserMapper;
import com.itheima.springbootmybatis.pojo.Merchant;
import com.itheima.springbootmybatis.service.UserService;
import com.itheima.springbootmybatis.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public Merchant findByUserName(String username) {
      Merchant u= userMapper.findByUserName(username);
      return u;

    }

    @Override
    public void register(String username, String password,String nickname,String contactPhone,String contactAddress) {
        //加密处理
        String md5String=Md5Util.getMD5String(password);
        //添加
        userMapper.add(username,md5String,nickname,contactPhone,contactAddress);
    }
}
